package com.zhao.common.support;

/**
 * 响应实体
 * 
 * @author zhaoyongfei
 *
 */
public final class Response {
	public static Response backResponse(StatusCodeEnum statusEnum, String statusMsg) {
		return backResponse(statusEnum, statusMsg, "");
	}

	public static Response backSuccess() {
		return backResponse(StatusCodeEnum.SUCCESS, "成功", "");
	}

	public static Response backSuccess(Object data) {
		return backResponse(StatusCodeEnum.SUCCESS, "成功", data);
	}

	public static Response backException(String statusMsg) {
		Response response = new Response();
		response.setData("");
		response.setStatusCode(StatusCodeEnum.UNDEFINED_EXCEPTION.getStatusCode());
		response.setStatusMsg(statusMsg);
		return response;
	}

	public static Response backResponse(StatusCodeEnum statusEnum, String statusMsg, Object data) {
		Response response = new Response();
		response.setData(data);
		response.setStatusMsg(statusMsg);
		response.setStatusCode(statusEnum.getStatusCode());
		return response;
	}

	private Object data;
	private String statusCode;
	private String statusMsg;

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public String getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}

	public String getStatusMsg() {
		return statusMsg;
	}

	public void setStatusMsg(String statusMsg) {
		this.statusMsg = statusMsg;
	}
}
